<body>
<div class="x-nav">
	<span class="layui-breadcrumb">
		<a href="">首页</a>
		<a href="">演示</a>
		<a>
			<cite>导航元素</cite></a>
	</span>
	<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
		<i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
	<div class="layui-row">
		<form class="layui-form layui-col-md12 x-so">
		<div class="layui-input-inline">
		<select name="status">
		<option>帖子状态</option>
		<option value="1">已结</option>
		<option value="2">未结</option>
		</select>
		</div>
		<div class="layui-input-inline">
		<select name="is_top">
		<option>是否置顶</option>
		<option value="1">已置顶</option>
		<option value="2">未置顶</option>
		</select>
		</div>
		<div class="layui-input-inline">
		<select name="is_good">
		<option>是否精贴</option>
		<option value="1">精贴</option>
		<option value="2">否精贴</option>
		</select>
		</div>
		<button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
		</form>
	</div>
	<xblock>
		<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
		<span class="x-right" style="line-height:40px">共有数据：{$we->total()} 条</span>
	</xblock>
	<table class="layui-table" style="">
		<thead>
		<tr>
			<th>
				<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
			</th>
			<th>ID<a href="{:url('admin/Ques/index',['ID'=>'desc'])}"><i class="layui-icon" style="font-size: 5px;" >&#xe619;</i></a><a href="{:url('admin/Ques/index',['ID'=>'ase'])}"><i class="layui-icon" style="font-size: 10px;" >&#xe61a;</i></a></th>
			<th>标题</th>
			<th>所属用户</th>
			<th>浏览量 <a href="{:url('admin/Ques/index',['view_num'=>'desc'])}"><i class="layui-icon" style="font-size: 5px;" >&#xe619;</i></a><a href="{:url('admin/Ques/index',['view_num'=>'ase'])}"><i class="layui-icon" style="font-size: 5px;">&#xe61a;</i></a></th>
			<th>回复量 <a href="{:url('admin/Ques/index',['reply_num'=>'desc'])}"><i class="layui-icon" style="font-size: 5px;" >&#xe619;</i></a><a href="{:url('admin/Ques/index',['reply_num'=>'ase'])}"><i class="layui-icon" style="font-size: 5px;">&#xe61a;</i></a></th>
			<th>飞吻<a href="{:url('admin/Ques/index',['kiss'=>'desc'])}"><i class="layui-icon" style="font-size: 5px;" >&#xe619;</i></a><a href="{:url('admin/Ques/index',['kiss'=>'ase'])}"><i class="layui-icon" style="font-size: 5px;" >&#xe61a;</i></a></th>
			<th>所属分类</th>
			<th>状态</th>
			<th>置顶</th>
			<th>精贴</th>
			<th>发布时间</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		{volist name='$ques' id='row'}
		<tr>
			<td>
				<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$row.question_id}'><i class="layui-icon">&#xe605;</i></div>
			</td>
			<td>{$row.question_id}</td>
			<td style="max-width:200px ;height: 20px;overflow: hidden;white-space: nowrap; text-overflow: ellipsis;"><a
					href="{:url('index/nom/index',['qid'=>$row.question_id])}">{$row.title}</a></td>
			<td>{$row.nickname}</td>
			<td>{$row.view_num}</td>
			<td>{$row.reply_num}</td>
			<td>{$row.kiss}</td>
			<td>{$row.cate_name}</td>
			<td>
				{if condition='$row.status==1'}
				<span class="layui-btn  layui-btn-sm  layui-btn-mini">已结</span>
				{else /}
				<span class="layui-btn layui-btn-sm  layui-btn-mini layui-btn-disabled">未结</span>
				{/if}
			</td>
			<td>
				{if condition='$row.is_top==1'}
				<span class="layui-btn  layui-btn-sm  layui-btn-normal layui-btn-mini">已置顶</span>
				{else /}
				<span class="layui-btn layui-btn-sm   layui-btn-normal layui-btn-mini layui-btn-disabled">未置顶</span>
				{/if}
			</td>
			<td>
				{if condition='$row.is_good==1'}
				<span class="layui-btn  layui-btn-warm  layui-btn-sm layui-btn-mini">为精贴</span>
				{else /}
				<span class="layui-btn layui-btn-sm  layui-btn-warm  layui-btn-mini layui-btn-disabled">否精贴</span>
				{/if}
			</td>
			<td>{$row.create_time}</td>
			<td class="td-manage">
				<a title="删除" onclick="member_del(this,{$row.question_id})" href="javascript:;">
					<i class="layui-icon">&#xe640;</i>
				</a>
			</td>
		</tr>
		{/volist}
		</tbody>
	</table>
	<div class="page">
		{$we->render()}
	</div>
</div>
<script>
	/*用户-删除*/
	function member_del(obj, id) {
		layer.confirm('确认要删除吗？', function (index) {
			//发异步删除数据
			$.post("{:url('admin/Ques/del')}", {question_id: id}, function(res, textStatus, xhr) {
                if (res.code == 0) {
                    layer.msg(res.msg, function () {
                    });
                } else {
                    layer.alert(res.msg, function () {
                        location.reload();
                    })
                }
			});
		});
	}

	function delAll(argument) {
		var data = tableCheck.getData();
		qid = '';
		for (var i in data){
		    qid +=data[i]+","
		}
		layer.confirm('确认要删除吗？' , function (index) {
			//捉到所有被选中的，发异步进行删除
			$.post("{:url('admin/Ques/del')}", {question_id: qid}, function(res, textStatus, xhr) {
                if (res.code == 0) {
                    layer.msg(res.msg, function () {
                    });
                } else {
                    layer.alert(res.msg, function () {
                        location.reload();
                    })
                }
			});
		});
	}
</script>
</body>
